#include "centerwgt.h"
#include <QLabel>
centerWgt::centerWgt(QWidget *parent)
    : QWidget{parent}
{
    this->setFixedSize(1080,600);//设置窗口大小
//    this->setStyleSheet("background-image: url(:/titlebar/tupian.jpg); background-repeat: no-repeat; background-size: cover;");
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setAttribute(Qt::WA_StyledBackground);
    QWidget* tupianWgt = new QWidget(this);

    //添加centereWgt控件
    QLabel* imageLabel = new QLabel(tupianWgt);

    // 设置固定尺寸
    imageLabel->setFixedSize(1200, 600);
    imageLabel->setStyleSheet("QLabel {"
                             "    border: transparent;"
                             "    background-color: black;"
                             "    background-repeat: no-repeat; "
                             "    border:1px groove transparent;"
                             "    border-radius:7px;"
                             "    padding:2px 4px;"
                             "    background-size: cover;"
//                             "    font: bold  15pt;"
                             "}");
    // 设置背景图像
    // 设置QLabel的背景图像，并调整大小以适应QLabel的尺寸
    QPixmap pixmap(":/titlebar/tupian.jpg");
    pixmap = pixmap.scaled(imageLabel->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
    imageLabel->setPixmap(pixmap);

}
